layui.define(['http'], function(exports){
    var http = layui.http.service;

    var greyServices = {

        /*整理接口,2017/07/26, author:lanlan.zeng*/
        //新增病历
        grey_post_medical_record: function (data) {
           /* var dto = {};
            dto.insurance_type = insuranceType;
            var patient = {};
            patient.name = patientName;
            patient.real_name = realName;
            patient.mobile = tel;
            patient.address = addr;
            patient.sex = patientSex;
            patient.birthday = birthday;
            patient.identity_card = id_card;
            dto.patient = patient;*/
            return http("/mandy/emr", {method: 'post', data: data});
        },

        //获取当前医生详细信息
        grey_get_medical_staff_info: function (medicalStaffId) {
            var dto = {};
            dto.medical_staff_id = medicalStaffId;
            return http("/mandy/medical_staff", {method: 'get', params: dto});
        },

        //获取当前医生详细信息
        grey_get_profile: function () {
            var dto = {};
            return http("/mandy/profile", {method: 'get', params: dto});
        },

        //获取医生列表
        grey_get_medical_staff_list: function (types, hospitalId, divisionId, station, provinceId, cityId, districtId, tagId, sortType) {
            grey_get_medical_staff_list_by_page(types, hospitalId, divisionId, station, provinceId, cityId, districtId, tagId, sortType, 1, 10000)
        },
        //获取医生列表
        grey_get_medical_staff_list_by_page: function (types, hospitalId, divisionId, station, provinceId, cityId, districtId, tagId, sortType, page, pageSize) {
            var dto = {};
            if (types != null) {
                dto.types = types;
            }
            dto.hospital_id = hospitalId;
            dto.division_id = divisionId;
            dto.province_id = provinceId;
            dto.city_id = cityId;
            dto.district_id = districtId;
            dto.station = station;
            dto.page = page;
            dto.page_size = pageSize;
            dto.tag_id = tagId;
            dto.sort_type = sortType;
            return http("/mandy/medical_staff_list", {method: 'get', params: dto});
        },

        //获取医院列表
        grey_get_hospital_list: function (name, cityId) {
            var dto = {};
            dto.hospital_name = name;
            dto.city_id = cityId;
            return http("/mandy/hospital_list", {method: 'get', params: dto});
        },

        //获取科室列表
        grey_get_division_list: function () {
            return http("/mandy/division_list");
        },

        //获取角色列表
        grey_get_role_list: function () {
            return http("/mandy/role_list");
        },

        //获取疾病列表
        grey_get_all_disease: function () {
            var dto = {};
            return http("/mandy/disease_list", {method: 'get', params: dto});
        },

        //获取量表列表
        grey_get_gauge_by_disease_id: function (disease_id) {
            var dto = {};
            dto.disease_id = disease_id;
            return http("/mandy/gauge_list", {method: 'get', params: dto});
        },

        //康复列表
        grey_get_prescription_list_by_emr_id: function (emr_id, page, pageSize) {
            var dto = {};
            dto.emr_id = emr_id;
            dto.page = page;
            dto.page_size = pageSize;
            return http("/mandy/prescription_list_by_emr_id", {method: 'get', params: dto});
        },

        //获取医院信息
        grey_get_hospital: function (id) {
            var dto = {};
            dto.hospital_id = id;
            return http("/mandy/hospital", {method: 'get', params: dto});
        },

        //获取医生信息
        grey_get_medical_staff: function (medical_staff_id) {
            var dto = {};
            dto.medical_staff_id = medical_staff_id;
            return http("/mandy/medical_staff", {method: 'get', params: dto});
        },

        //康复处方列表
        grey_get_prescription_by_emr_id: function (emr_id, type, is_referral_history) {
            var dto = {};
            dto.emr_id = emr_id;
            dto.type = type;
            dto.is_referral_history = is_referral_history;
            return http("/mandy/prescription_by_emr_id", {method: 'get', params: dto});
        },

        //康复处方
        grey_get_prescription: function (prcpId, emr_id, is_referral_history) {
            var dto = {};
            dto.prcp_id = prcpId;
            dto.emr_id = emr_id;
            dto.is_referral_history = is_referral_history;
            return http("/mandy/prescription", {method: 'get', params: dto});
        },

        /**********待写接口文档***************************/
        //文件上传相关
        grey_get_certificate_upload_info: function (file) {
            var dto = {};
            var filename = file.name;
            dto.type = filename.substr(filename.lastIndexOf(".") + 1);
            return http("/mandy/certificate_upload_info", {method: 'get', params: dto});
        }
    }

    exports("greyServices", greyServices);
}
)